﻿<!DOCTYPE HTML>
<html>
<head>
<#include "/script.ftl">
<title>订单统计报表</title>
<link rel="stylesheet" type="text/css" href="../static/eth/css/report.css" />
<script type="text/javascript" src="../static/eth/js/jElass.js"></script>
<script type="text/javascript" src="../static/eth/js/jElassExec.js"></script>
<script type="text/javascript" src="../static/eth/js/report.js"></script>
</head>
<body id="body" class="report_body">
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页
		<span class="c-gray en">&gt;</span> 统计
		<span class="c-gray en">&gt;</span> 销售统计报表
	</nav>
	<div class="page-container">
		<div class="report_head">
			<form id="form" method="get" action="wangdian" autocomplete="off">
				<input type="text" style="display:none" name="pageIndex" id="pageIndex" value="${page.curIndex!''}"/>
				<input type="text" style="display:none" name="pageSize" id="pageSize" value="${page.pageSize!''}" />
				<input type="text" style="display:none" name="rowsCount" id="rowsCount" value="${page.rowsCount!''}" />
				<div class="report_line1">
					<div class="report_item1 cl">
						<label>统计方式</label>				
						<select  id="condition" name="condition" class="input-text">
							<option value="list" <#if (fare.condition)! ='list'>selected="selected"</#if>>按明细</option>
							<option value="wangDian" <#if (fare.condition)! ='wangDian'>selected="selected"</#if>">按网店</option>
							<option value="airline" <#if (fare.condition)! ='airline'>selected="selected"</#if>">按航司</option>
							<option value="flight" <#if (fare.condition)! ='flight'>selected="selected"</#if>">按航线</option>
							<option value="airlineAndFlight" <#if (fare.condition)! ='airlineAndFlight'>selected="selected"</#if>">按航司航线</option>
							<option value="departureDate" <#if (fare.condition)! ='departureDate'>selected="selected"</#if>">按起飞时段</option>
							<option value="month" <#if (fare.condition)! ='month'>selected="selected"</#if>">按月统计</option>
							<option value="bookOperator" <#if (fare.condition)! ='bookOperator'>selected="selected"</#if>">按订票员</option>
							<option value="drawOperator" <#if (fare.condition)! ='drawOperator'>selected="selected"</#if>">按出票员</option>
							<option value="9" <#if (fare.condition)! ='9'>selected="selected"</#if>">按收银员</option>
							<option value="10" <#if (fare.condition)! ='10'>selected="selected"</#if>">按调度人员</option>
						</select>
					</div>
					<div class="report_item1 cl">
						<label>日期条件</label>
						<select name="dateCondition" id="date_condition" class="input-text">
							<option value="operatoringTime" <#if (fare.dateCondition)! ='operatoringTime'>selected="selected"</#if>>出票时间</option>
							<option value="departureDate" <#if (fare.dateCondition)! ='departureDate'>selected="selected"</#if>>起飞时间</option>
						</select>
					</div>
					<div class="report_item3 cl date_condition_div others">
						<label class="label_class1">出票起止时间</label>
						<input type="text" name="operatoringTimeStartStr" value="${(fare.operatoringTimeStartStr)!''}" class="input-text Wdate" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'operatoringTimeEndStr\')}'})" autocomplete="off" id="operatoringTimeStartStr" placeholder="yyyy-MM-dd">
						<label class="label_class2">至</label>
						<input type="text" name="operatoringTimeEndStr" value="${(fare.operatoringTimeEndStr)!''}" class="input-text Wdate" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'operatoringTimeStartStr\')}'})" autocomplete="off" id="operatoringTimeEndStr" placeholder="yyyy-MM-dd">
					</div>
					<div class="report_item3 cl date_condition_div others">
						<label class="label_class1">起飞起止时间</label>
						<input type="text" name="departureDateStartStr" value="${(order.departureDateStartStr)!''}" class="input-text Wdate" onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'departureDateEndStr\')}'})" autocomplete="off" id="departureDateStartStr" placeholder="yyyy-MM-dd">
						<label class="label_class2">至</label>
						<input type="text" name="departureDateEndStr" value="${(order.departureDateEndStr)!''}" class="input-text Wdate" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'departureDateStartStr\')}'})" autocomplete="off" id="departureDateEndStr" placeholder="yyyy-MM-dd">
					</div>
				</div>
				<div class=" div_bar others">
					<div class="report_line2">
						<div class="report_item1 cl">
							<label>订票员</label>
							<input type="text" class="input-text " name="bookOperatorName" value="${(order.bookOperatorName)!''}" onClick="OperatorId(bookOperatorName,bookOperatorId)">
							<input type="hidden" name="bookOperatorId" id="bookOperatorId" value="${(order.bookOperatorId)!''}">
						</div>
						<div class="report_item1 cl">
							<label>出票员</label>
							<input type="text" class="input-text" name="drawOperatorName" value="${(fare.drawOperatorName)!''}" onClick="OperatorId(drawOperatorName,drawOperatorId)">
							<input type="hidden" name="drawOperatorId" id="drawOperatorId"  value="${(fare.drawOperatorId)!''}">
						</div>
						<div class="report_item1 cl">
							<label>订票部门</label>
							<select class="input-text">
								<option value="">国际网店</option>
								<option value="">国际同业</option>
								<option value="">不限</option>
							</select>
						</div>
						<div class="report_item1 cl">
							<label>票证状态</label>
							<select class="input-text" name="ticketStatus">
								<option value="">不限</option>
								<option value="TICKET_TYPE_NORMAL" <#if (fare.ticketStatus)! ="TICKET_TYPE_NORMAL">selected="selected"</#if> >正常票</option>
								<option value="TICKET_TYPE_REFUND" <#if (fare.ticketStatus)! ="TICKET_TYPE_REFUND">selected="selected"</#if> >退票</option>
								<option value="TICKET_TYPE_INVALID" <#if (fare.ticketStatus)! ="TICKET_TYPE_INVALID">selected="selected"</#if> >废票</option>	
							</select>
						</div>
						<div class="report_item1 cl">
							<label>客户名称</label>
							<input type="text" name="clientName" value="${(order.clientName)!}" onClick="ClientId(clientName,clientId)" class="input-text">
							<input type="hidden" name="clientId" id="clientId" value="${(order.clientId)!}">
						</div>
					</div>
					<div class="report_line2">
						<div class="report_item3 cl">
							<label>订单备注</label>
							<input type="text" name="memo" value="${(order.memo)!}" class="input-text input_width" placeholder="支持模糊查询，可直接输入政策员名">
						</div>
									
					</div>					
				</div>
				<div class=" div_bar others">
					<div class="report_line2">
						<div class="report_item3 cl">
							<label>网店</label>
							<input type="text" name="eshopName" id="eshopName" value="${(fare.eshopName!)}" onClick="EshopId('eshopName','eshopId')"  class="input-text input_width" >
							<input type="hidden" name="eshopId" id="eshopId" value="">
						</div>						
					</div>
				</div>
				<div class=" div_bar others">
					<div class="report_line2">
						<div class="report_item3 cl">
							<label>航司</label>
							<input type="text" name="airlineName" value="${(order.airlineName)!}" onClick="AirlineCode(airlineName,airline)" class="input-text input_width" >
							<input type="hidden" name="airline" id="airline" value="${(order.airline)!}">
						</div>
						
					</div>
				</div>
				<div class="div_bar others">
					<div class="report_line2">
						<div class="report_item3 cl">
							<label>航线</label>
							<input type="text" name="departureCityName" value="${order.departureCityName!}" onClick="CityCode(departureCityName, departureCity)" class="input-text" >
							<input type="hidden" name="departureCity" value="${order.departureCity!}" id="departureCity" class="input-text" >
							<label class="label_class2">至</label>
							<input type="text" name="arrivalCityName" value="${order.arrivalCityName!}" onClick="CityCode(arrivalCityName, arrivalCity)" class="input-text" >
							<input type="hidden" name="arrivalCity" value="${order.arrivalCity!}" id="arrivalCity" class="input-text" >
						</div>
					</div>
				</div>
				<div class="div_bar others">
					<div class="report_line2">
						<div class="report_item2 cl">
							<label>航司</label>
							<input type="text" name="airlineName" value="${(order.airlineName)!}" onClick="AirlineCode(airlineName,airline)" class="input-text input_width" >
							<input type="hidden" name="airline" id="airline" value="${(order.airline)!}">
						</div>
						<div class="report_item3 cl">
							<label>航线</label>
							<input type="text" name="departureCityName" value="${order.departureCityName!}" onClick="CityCode(departureCityName, departureCity)" class="input-text" >
							<input type="hidden" name="departureCity" id="departureCity" value="${order.departureCity!}"  class="input-text" >
							<label class="label_class2">至</label>
							<input type="text" name="arrivalCityName" value="${order.arrivalCityName!}" onClick="CityCode(arrivalCityName, arrivalCity)" class="input-text" >
							<input type="hidden" name="arrivalCity" value="${order.arrivalCity!}" id="arrivalCity" class="input-text" >
						</div>	
					</div>
				</div>
				<div class="div_bar others">
					<div class="report_line2">
						<div class="report_item3 cl">	
						</div>	
					</div>
				</div>
				<div class="div_bar others">
					<div class="report_line2">	
					</div>
				</div>
				<div class="div_bar others">
					<div class="report_line2">
						<div class="report_item3 cl">
							<label>订票员</label>
							<input type="text" class="input-text" name="bookOperatorName" value="${(order.bookOperatorName)!''}" onClick="OperatorId(bookOperatorName,bookOperatorId)">
							<input type="hidden" name="bookOperatorId" id="bookOperatorId" value="${(order.bookOperatorId)!''}">
						</div>	
					</div>
				</div>
				<div class="div_bar others">
					<div class="report_line2">
						<div class="report_item3 cl">
							<label>出票员</label>
							<input type="text" class="input-text" name="drawOperatorName" value="${(fare.drawOperatorName)!''}" onClick="OperatorId(drawOperatorName,drawOperatorId)">
							<input type="hidden" name="drawOperatorId" id="drawOperatorId"  value="${(fare.drawOperatorId)!''}">
						</div>
					</div>
				</div>
				<div class="div_bar others">
					<div class="report_line2">
						<div class="report_item3 cl">
							<label>收银员</label>
							<input type="text" class="input-text input_width" >
						</div>
						
					</div>
				</div>
				<div class="div_bar others">
					<div class="report_line2">
						<div class="report_item3 cl">
							<label>调度人员</label>
							<input type="text" class="input-text input_width" >
						</div>
						<div class="report_item4 cl">
							<input type="reset" class="btn btn-default " value="清空">
							<input type="button" class="btn btn-primary mr-20 btn_submit" value="查询">
						</div>
					</div>
				</div>
			</form>
		</div>
		
		<div class="report_content others" >
			<strong>明细
				<#if fare.dateCondition! ="departureDate">
					<#if order.departureDateStartStr??>
						<#if order.departureDateStartStr !='' && order.departureDateEndStr !=''>
						${order.departureDateStartStr!}至${order.departureDateEndStr!}起飞
						<#elseif order.departureDateStartStr !=''>
						${order.departureDateStartStr!}至今起飞
						<#elseif order.departureDateEndStr !=''>
						${order.departureDateEndStr!}之前起飞
						<#else>
							全部
						</#if>
					<#else>
						全部
					</#if>
				<#elseif fare.dateCondition! ="operatoringTime">
					<#if fare.operatoringTimeStartStr??>
						<#if fare.operatoringTimeStartStr !='' && fare.operatoringTimeEndStr !=''>
						${fare.operatoringTimeStartStr!}至${fare.operatoringTimeEndStr!}出票
						<#elseif fare.operatoringTimeStartStr !=''>
						${fare.operatoringTimeStartStr!}至今出票
						<#elseif fare.operatoringTimeEndStr !=''>
						${fare.operatoringTimeEndStr!}之前出票
						<#else>
							全部
						</#if>	
					<#else>
						全部
					</#if>
				</#if>
				统计记录
			</strong>			
			<table class=" table table-border table-bordered radius table-hover">
				<thead class="text-c ">
					<tr>
						<th width="4%">序号</th>
						<th width="4%">订票员</th>
						<th width="4%">出票员</th>
						<th width="4%">订票部门</th>	
						<th width="4%">票证状态</th>
						<th width="4%">订单备注</th>
						<th width="5%">客户名称</th>
						<th width="4%">毛利</th>
						<th width="3%">代理费率</th>
						<th width="3%">代理费</th>
						<th width="3%">后返费率</th>
						<th width="3%">后返金额</th>
						<th width="3%">加价让利</th>
						<th width="5%">毛利小计含后返</th>
						<th width="3%">保险销售</th>
						<th width="6%">承运人-票号</th>
						<th width="5%">出票时间</th>
						<th width="4%">采购服务费</th>
						<th width="5%">销售价</th>
						<th width="5%">账单价</th>
					</tr>
				</thead>
				<tbody>
					<#if page.items??>			
					<#list page.items! as fare>
					<tr class="text-c">
						<td>${page.pageSize * (page.curIndex-1) + fare_index+1}</td>
						<td>${(fare.order.operator.userName)!""}</td>
						<td>${(fare.operator.userName)!}</td>
						<td></td>
						<td><#if fare.ticketType! = "TICKET_TYPE_NORMAL">正常票
							<#elseif fare.ticketType! = "TICKET_TYPE_REFUND">退票
							<#elseif fare.ticketType! = "TICKET_TYPE_INVALID">废票
							</#if>
						</td>
						<td></td>
						<td>${(fare.order.client.clientName)!''}</td>
						<td>#{(fare.totalAmount!0)-(fare.vendorTotalAmount!0)-(fare.addPrice!0);m2M2}</td>
						<td><#if fare.ticketPrice?? >#{(fare.commisionPrice!0);m2M2}<#else>0</#if></td><#--${(fare.commisionPrice!0)/(fare.ticketPrice!0)}-->
						<td>#{fare.commisionPrice!0;m2M2}</td>
						<td><#if fare.ticketPrice?? >#{(fare.reward!0);m2M2}<#else>0</#if></td><#--${(fare.reward!0)/(fare.ticketPrice!0)}-->
						<td>#{fare.reward!0;m2M2}</td>
						<td>#{fare.addPrice!0;m2M2}</td>
						<td>#{(fare.totalAmount!0)-(fare.vendorTotalAmount!0);m2M2}</td>
						<td>0.00</td>
						<td>-${fare.ticketNum!""}</td>
						<td>${fare.operatoringTimeStr!""}</td>
						<td>#{fare.vendorTotalAmount!0;m2M2}</td>
						<td>#{fare.totalAmount!0;m2M2}</td>
						<td>#{fare.totalAmount!0;m2M2}</td>															
					</tr>
					</#list>
					<#else>
						<tr>
							<td colspan="20">暂无统计记录</td>
						</tr>
					</#if>
				</tbody>
			</table>
		</div>
		<div class="report_content others">
			<strong>			
				<#if fare.dateCondition! ="departureDate">
					<#if order.departureDateStartStr??>
						<#if order.departureDateStartStr !='' && order.departureDateEndStr !=''>
						${order.departureDateStartStr!}至${order.departureDateEndStr!}起飞
						<#elseif order.departureDateStartStr !=''>
						${order.departureDateStartStr!}至今起飞
						<#elseif order.departureDateEndStr !=''>
						${order.departureDateEndStr!}之前起飞
						<#else>
							全部
						</#if>
					<#else>
						全部
					</#if>
				<#elseif fare.dateCondition! ="operatoringTime">
					<#if fare.operatoringTimeStartStr??>
						<#if fare.operatoringTimeStartStr !='' && fare.operatoringTimeEndStr !=''>
						${fare.operatoringTimeStartStr!}至${fare.operatoringTimeEndStr!}出票
						<#elseif fare.operatoringTimeStartStr !=''>
						${fare.operatoringTimeStartStr!}至今出票
						<#elseif fare.operatoringTimeEndStr !=''>
						${fare.operatoringTimeEndStr!}之前出票
						<#else>
							全部
						</#if>	
					<#else>
						全部
					</#if>
				</#if>
				统计记录
			</strong>			
			<table class="table table-border table-bordered radius table-hover">
				<thead class="text-c">
					<tr>
						<th rowspan="2" width="3%">序号</th>
						<th rowspan="2" width="5%">
							<#if (fare.condition)! ="wangDian">网店
							<#elseif (fare.condition)! ="airline" || (fare.condition)! ="airlineAndFlight">航司
							<#elseif (fare.condition)! ="flight">航程	
							<#elseif (fare.condition)! ="bookOperator">订票员
							<#elseif (fare.condition)! ="drawOperator">出票员
							<#elseif (fare.condition)! ="month">月份
							<#elseif (fare.condition)! ="departureDate">起飞时段				
							</#if>
						</th>
						<#if (fare.condition)! ="flight">
							<th rowspan="2" width="5%">航程名称</th>
						</#if>
						<#if (fare.condition)! ="airlineAndFlight">
							<th rowspan="2" width="5%">航程</th>
							<th rowspan="2" width="5%">航程名称</th>
						</#if>
						<th colspan="12">正常票</th>
						<th colspan="3">退票</th>
						<th colspan="3">废票</th>
						
					</tr>
					<tr >
						<th width="4%">张数</th>
						<th width="5%">占比</th>
						<th width="5%">采购价</th>
						<th width="5%">销售价</th>
						<th width="3%">机建</th>
						<th width="5%">税费</th>
						<th width="4%">小计</th>
						<th width="3%">保险金额</th>
						<th width="3%">接车</th>
						<th width="3%">其他</th>
						<th width="5%">合计</th>
						<th width="5%">已付金额</th>
						<th width="4%">张数</th>
						<th width="5%">退票费</th>
						<th width="5%">实退金额</th>
						<th width="4%">张数</th>
						<th width="3%">工本费</th>
						<th width="5%">实退金额</th>
					</tr>
				</thead>
				<tbody class="text-c">
					<#list page.items! as report>
					<#if report??>
					<tr >
						<td>${page.pageSize*(page.curIndex-1)+report_index+1}</td>
						<td>
							<#if (fare.condition)! ="wangDian">${(report.eshopName)!}
							<#elseif (fare.condition)! ="airline" || (fare.condition)! ="airlineAndFlight">${(report.airlineName)!}
							<#elseif (fare.condition)! ="flight">${(report.departureCity)!}--${(report.arrivalCity)!}
							<#elseif (fare.condition)! ="bookOperator">${(report.bookOperatorCode)!}/${(report.bookOperatorName)!}
							<#elseif (fare.condition)! ="drawOperator">${(report.drawOperatorCode)!}/${(report.drawOperatorName)!}
							<#elseif (fare.condition)! ="month">
								<#if (fare.dateCondition)! ="departureDate">
									${(report.departureDateStr)!}
								<#elseif (fare.dateCondition)! ="operatoringTime">
									${(report.operatoringTimeStr)!}
								</#if>
							<#elseif (fare.condition)! ="departureDate">
								${(report.departureDate)!}	
							</#if>
						</td>
						
						<#if (fare.condition)! ="flight">
							<td>${(report.departureCityName)!}--${(report.arrivalCityName)!}</td>
						</#if>
						<#if (fare.condition)! ="airlineAndFlight">
							<td>${(report.departureCity)!}--${(report.arrivalCity)!}</td>
							<td>${(report.departureCityName)!}--${(report.arrivalCityName)!}</td>
						</#if>
						<td>${(report.totalNormalTicket)!}</td>
						<td><#if report.totalTicket??>#{((report.totalNormalTicket)!)/((report.totalTicket)!)*100;m2M2}%<#else>0.00%</#if></td>
						<td>${(report.vendorTotalAmountStr)!}</td>
						<td>${(report.totalAmountStr)!}</td>
						<td>0.00</td>
						<td>${(report.totalTaxStr)!}</td>
						<td><#if report.totalTax?? && report.totalAmount??>#{report.totalTax+report.totalAmount;m2M2}</#if></td>
						<td>0.00</td>
						<td>0.00</td>
						<td>0.00</td>
						<td><#if report.totalTax?? && report.totalAmount??>#{report.totalTax+report.totalAmount;m2M2}</#if></td>
						<td>0.00</td>
						<td>${(report.totalRefundTicket)!}</td>
						<td>${(report.totalRefundPriceStr)!}</td>
						<td>${(report.totalRefundActualAmountStr)!}</td>
						<td>${(report.totalInvalidTicket)!}</td>
						<td>${(report.totalAbandonPriceStr)!}</td>
						<td>${(report.totalInvalidActualAmountStr)!}</td>																			
					</tr>
					</#if>
					</#list>
					<#if report??>
					<tr style="background-color:rgba(242, 242, 242, 1);">
						<td></td>
						<td>
							<#if (fare.condition)! ="list" || (fare.condition)! ="flight" || (fare.condition)! ="airlineAndFlight" >		
							<#else>
								总
							</#if>
						</td>
						<#if (fare.condition)! ="flight">
							<td>总</td>
						</#if>
						<#if (fare.condition)! ="airlineAndFlight">
							<td></td>
							<td>总</td>
						</#if>
						<td>${report.totalNormalTicket!}</td>
						<td></td>
						<td>${report.vendorTotalAmountStr!}</td>
						<td>${report.totalAmountStr!}</td>
						<td>0.00</td>
						<td>${report.totalTaxStr!}</td>
						<td><#if report.totalTax?? && report.totalAmount??>#{report.totalTax+report.totalAmount;m2M2}</#if></td>
						<td>0.00</td>
						<td>0.00</td>
						<td>0.00</td>
						<td><#if report.totalTax?? && report.totalAmount??>#{report.totalTax+report.totalAmount;m2M2}</#if></td>
						<td>0.00</td>
						<td>${report.totalRefundTicket!}</td>
						<td>${report.totalRefundPriceStr!}</td>
						<td>${report.totalRefundActualAmountStr!}</td>
						<td>${report.totalInvalidTicket!}</td>
						<td>${report.totalAbandonPriceStr!}</td>
						<td>${report.totalInvalidActualAmountStr!}</td>
					</tr>
					<#else>
						<tr>
							<td colspan="30">暂无统计记录</td>
						</tr>
					</#if>				
				</tbody>
			</table>
		</div>		
		<div id="Pagination" class="pagination mt-20" style="margin-bottom:50px"></div>
	<div>
<script>
	$(function(){
		$.condition();
		$.dateCondition();
		
		//给提交按钮绑定点击事件
		$(".div_bar").on("click","input[type='button']",function(){				
			$(".div_bar").find("input[type='hidden']").each(function(index,dom){
				if($(dom).prev().val() == ''){
					$(dom).val('');
				}				
			})
			$("#pageIndex").val(1);
			$("#form").submit();
		});
		//给清空按钮绑定点击事件
		$("input[type='reset']").click(function(){
			$(':input','#form').not(':button, :submit, :reset, select').val('');
		});
		
	})
</script>
</body>
</html>